package wifiunion.com.notice;

import com.google.gson.reflect.TypeToken;

import java.util.HashMap;
import java.util.List;

import wifiunion.com.notice.entity.DeviceInList;
import wifiunion.com.notice.entity.DeviceLocation;
import wifiunion.com.notice.entity.DeviceRlGroupDetail;
import wifiunion.com.notice.entity.MemberChild;
import wifiunion.com.notice.entity.NoticeCondition;
import wifiunion.com.notice.entity.NoticeDeviceRlGroup;
import wifiunion.com.notice.entity.NoticeGroup;
import wifiunion.com.notice.entity.NoticeInfoList;
import wifiunion.com.notice.entity.NoticeTargetRelGroup;
import wifiunion.com.notice.entity.NoticeTopGroupEntity;
import wifiunion.com.notice.entity.NoticeUserList;
import wifiunion.com.notice.entity.SubNoticeTargetEntity;

/**
 * Created by Administrator on 2016/11/23.
 */

public class NoticeModel implements NoticeContact.Model {
    @Override
    public void loadData(String url, HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(url, params,
                callBack, new TypeToken<List<DeviceLocation>>() {
                }.getType());
    }


    public void getGroupList(HashMap<String, Object> params, BaseCallBack callBack, int mType) {

        String url = null;
        if (mType == 0) {
            url = Constants.HTTP_URL_GET_NOTICE_GROUPLIST;
        } else {
            url = Constants.HTTP_URL_GET_PATROL_GROUPLIST;
        }

        HttpUtils.HttpGetRequest_Asyn(url, params,
                callBack, new TypeToken<List<NoticeGroup>>() {
                }.getType());
    }


    public void getNoticeList(HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_NOTICE_LIST, params,
                callBack, null);
    }


    public void getNotificationUser(HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_NOTICEUSER_LIST, params,
                callBack, new TypeToken<List<NoticeUserList>>() {
                }.getType());
    }

    public void getNoticeRelGroupList(HashMap<String, Object> params, BaseCallBack callBack, int mType) {

        String url = null;
        if (mType == 0) {
            url = Constants.HTTP_URL_GET_NOTICEUSER_RELGROUPLIST;
        } else if (mType == 1) {
            url = Constants.HTTP_URL_GET_PATROLUSER_RELGROUPLIST;
        } else if (mType == 2) {
            url = Constants.HTTP_URL_GET_EXPOSUREUSER_RELGROUPLIST;
        }

        HttpUtils.HttpGetRequest_Asyn(url, params,
                callBack, new TypeToken<List<NoticeGroup>>() {
                }.getType());
    }

    public void getNoticeRelGoupMemberList(HashMap<String, Object> params, BaseCallBack callBack, int mType) {

        String url = null;
        if (mType == 0) {
            url = Constants.HTTP_URL_GET_NOTICEUSER_RELGROUPUUIDLIST;
        } else if (mType == 1) {
            url = Constants.HTTP_URL_GET_PATROLUSER_RELGROUPUUIDLIST;
        } else if (mType == 2) {
            url = Constants.HTTP_URL_GET_EXPOSUREUSER_RELGROUPUUIDLIST;
        }


        HttpUtils.HttpGetRequest_Asyn(url, params,
                callBack, new TypeToken<List<MemberChild>>() {
                }.getType());
    }


    public void addNoticeSBDX(HashMap<String, Object> params, BaseCallBack callBack, int mType) {

        String url = null;
        if (mType == 0) {
            url = Constants.HTTP_URL_GET_NOTICEUSER_USERADD;
        } else if (mType == 1) {
            url = Constants.HTTP_URL_GET_PATROLUSER_USERADD;
        } else if (mType == 2) {
            url = Constants.HTTP_URL_POST_EXPOSUREUSER_USERADD;
        }


        HttpUtils.HttpPostRequest_Asyn(url, params, callBack,
                new TypeToken<String>() {
                }.getType(), false);

    }

    public void addNoticeSBSD(HashMap<String, Object> params, BaseCallBack callBack) {

        HttpUtils.HttpPostRequest_Asyn(Constants.HTTP_URL_GET_NOTICEUSER_TIME, params, callBack,
                new TypeToken<String>() {
                }.getType(), false);

    }

    public void getNoticeRelGroupUuid(HashMap<String, Object> params, BaseCallBack callBack, int mType) {

        String url = null;
        if (mType == 0) {
            url = Constants.HTTP_URL_GET_NOTICERLDEVICEGROUPUUID;
        } else if (mType == 1) {
            url = Constants.HTTP_URL_GET_PATROLDEVICEGROUPUUID;
        } else if (mType == 2) {
            url = Constants.HTTP_URL_GET_EXPOSUREDEVICEGROUPUUID;
        }

        HttpUtils.HttpGetRequest_Asyn(url, params,
                callBack, new TypeToken<List<DeviceRlGroupDetail>>() {
                }.getType());

    }

    public void addNoticeDevice(HashMap<String, Object> params, BaseCallBack callBack, int mType) {

        String url = null;
        if (mType == 0) {
            url = Constants.HTTP_URL_GET_NOTICERLDEVICEADD;
        } else if (mType == 1) {
            url = Constants.HTTP_URL_GET_PATROLDEVICEADD;
        } else if (mType == 2) {
            url = Constants.HTTP_URL_POST_EXPOSUREDEVICEADD;
        }


        HttpUtils.HttpPostRequest_Asyn(url, params, callBack,
                new TypeToken<String>() {
                }.getType(), false);

    }

    public void getNoticeDeviceList(String url, HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(url, params,
                callBack, new TypeToken<List<DeviceInList>>() {
                }.getType());
    }

    public void getTopGroupList(HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_NOTICTOPGROUP, params,
                callBack, new TypeToken<List<NoticeTopGroupEntity>>() {
                }.getType());
    }

    public void getNoticeTargetList(HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_NOTICTARGETLIST, params,
                callBack, new TypeToken<List<SubNoticeTargetEntity>>() {
                }.getType());
    }

    public void getTargetRelGroupList(HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_NOTICTARGETRELGROUPLIST, params,
                callBack, new TypeToken<List<NoticeTargetRelGroup>>() {
                }.getType());
    }

    public void getNoticeTargetRelGroupUuid(HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_NOTICTARGETRELGROUPUUID, params,
                callBack, new TypeToken<List<SubNoticeTargetEntity>>() {
                }.getType());
    }


    public void addNoticeTargetDevice(HashMap<String, Object> params, BaseCallBack callBack) {

        HttpUtils.HttpPostRequest_Asyn(Constants.HTTP_URL_GET_NOTICERLDTARGETEADD, params, callBack,
                new TypeToken<String>() {
                }.getType(), false);

    }

    public void addNoticeData(HashMap<String, Object> params, BaseCallBack callBack) {

        HttpUtils.HttpPostRequest_Asyn(Constants.HTTP_URL_GET_NOTICCONTENTADD, params, callBack,
                new TypeToken<String>() {
                }.getType(), false);

    }

    public void deleteNotice(HashMap<String, Object> params, BaseCallBack callBack, int mType) {

        String url = null;
        if (mType == 0) {
            url = Constants.HTTP_URL_GET_NOTICEDEL;
        } else {
            url = Constants.HTTP_URL_GET_PATROLDEL;
        }


        HttpUtils.HttpGetRequest_Asyn(url, params,
                callBack, new TypeToken<String>() {
                }.getType());

    }


    public void addNoticeGroup(HashMap<String, Object> params, BaseCallBack callBack, int mType) {

        String url = null;
        if (mType == 0) {
            url = Constants.HTTP_URL_GET_NOTICEADDGROUP;
        } else {
            url = Constants.HTTP_URL_GET_PATROLADDGROUP;
        }

        HttpUtils.HttpPostRequest_Asyn(url, params, callBack,
                new TypeToken<String>() {
                }.getType(), false);

    }

    public void addNoticeRelGroup(HashMap<String, Object> params, BaseCallBack callBack, int mType) {

        String url = null;
        if (mType == 0) {
            url = Constants.HTTP_URL_GET_NOTICEADDRELGROUP;
        } else {
            url = Constants.HTTP_URL_GET_PATROLADDRELGROUP;
        }

        HttpUtils.HttpPostRequest_Asyn(url, params, callBack,
                new TypeToken<String>() {
                }.getType(), false);

    }

    public void setisNotificationFrom(HashMap<String, Object> params, BaseCallBack callBack) {

        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_NOTICEFROM, params,
                callBack, new TypeToken<String>() {
                }.getType());

    }

    public void getNoticeDetail(HashMap<String, Object> params, BaseCallBack callBack) {

        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_NOTICEDETAIL, params,
                callBack, new TypeToken<NoticeInfoList>() {
                }.getType());

    }


    public void deleteNoticeGroup(HashMap<String, Object> params, BaseCallBack callBack, int mType) {


        String url = null;
        if (mType == 0) {
            url = Constants.HTTP_URL_GET_NOTICEDELGROUP;
        } else {
            url = Constants.HTTP_URL_GET_PATROLDELGROUP;
        }

        HttpUtils.HttpGetRequest_Asyn(url, params,
                callBack, new TypeToken<String>() {
                }.getType());

    }

    public void getRlGroup(String url, HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(url, params,
                callBack, new TypeToken<List<NoticeDeviceRlGroup>>() {
                }.getType());
    }


    public void copyNotice(HashMap<String, Object> params, BaseCallBack callBack, int mType) {

        String url = null;
        if (mType == 0) {
            url = Constants.HTTP_URL_GET_COPYNOTICE;
        } else {
            url = Constants.HTTP_URL_GET_COPYPATROL;
        }

        HttpUtils.HttpGetRequest_Asyn(url, params,
                callBack, new TypeToken<String>() {
                }.getType());
    }

    public void getRelevanceNoticeList(HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_RELEVANCENOTICE_LIST, params,
                callBack, new TypeToken<List<NoticeInfoList>>() {
                }.getType());
    }

    public void getRelevanceNoticeCondition(HashMap<String, Object> params, BaseCallBack callBack) {
        HttpUtils.HttpGetRequest_Asyn(Constants.HTTP_URL_GET_RELEVANCENOTICETIME, params,
                callBack, new TypeToken<NoticeCondition>() {
                }.getType());
    }


    public void addRelevanceNotice(HashMap<String, Object> params, BaseCallBack callBack) {

        HttpUtils.HttpPostRequest_Asyn(Constants.HTTP_URL_POST_ADDRELEVANCENOTICE, params, callBack,
                new TypeToken<String>() {
                }.getType(), false);

    }

    public void addRelevanceNoticeCondition(HashMap<String, Object> params, BaseCallBack callBack) {

        HttpUtils.HttpPostRequest_Asyn(Constants.HTTP_URL_POST_RELEVANCENOTICETIME, params, callBack,
                new TypeToken<String>() {
                }.getType(), false);

    }



}
